package model.base;

/**
 *
 *
 *
 */
public class Room extends MapSite {

	private MapSite[] sides;
	private int       roomNumber;

	public Room(int roomNo) {

		this.sides = new MapSite[4];
		this.roomNumber = roomNo;
	}

	public void Initialize(int roomNo) {
		this.roomNumber = roomNo;
	}

	@Override
	public void Enter() {
		System.err.println("Room");
	}

	public MapSite GetSide(Direction direction) {
		if (sides == null) {
			return null;
		}
		return sides[direction.getValue()];
	}

	public void SetSide(Direction direction, MapSite mapSite) {
		this.sides[direction.getValue()] = mapSite;
	}

	public int getRoomNumber() {
		return this.roomNumber;
	}

	private void clone(Room room) {
		room.sides = new MapSite[4];
		System.arraycopy(room.sides, 0, this.sides, 0, room.sides.length);
	}

	@Override
	public Room clone() throws CloneNotSupportedException {

		Room cloneRoom = (Room) super.clone();
		clone(cloneRoom);
		return cloneRoom;
	}
}
